import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    leftList: JSON.parse(sessionStorage.getItem('leftList') || '[]'),
    username: sessionStorage.getItem('username'),
    photo: sessionStorage.getItem('photo')
  },
  mutations: {
    addLeftList(state, data) {
      state.leftList = data;
      sessionStorage.setItem("leftList", JSON.stringify(data));
    },
    setUsername(state, data) {
      state.username = data;
      sessionStorage.setItem("username", data)
    },
    setPhoto(state, data) {
      state.photo = data;
      sessionStorage.setItem("photo", data)
    }
  },
  actions: {
  },
  modules: {
  }
})
